/**
 * 用户登录接口
 */

import request from '@/utils/request'



export const login = data=>{
    return request({
        method:'POST',
        url:'/app/v1_0/authorizations',
        data
    })
}

/**
 * 获取短信验证码
 */

export const sendSms = mobile=>{
    return request({
        method:'GET',
        url:`/app/v1_0/sms/codes/${mobile}`,
        mobile
    })
}

/**
 * 获取用户信息
 */

export const getCurrenUser = ()=>{
    return request({
        method:'GET',
        url:'/app/v1_0/user'
    })
} 

/**
 * 获取用户频道列表
 */
export const getUserChannels = ()=>{
    return request({
        method:'GET',
        url:'/app/v1_0/user/channels'
    })
}


/**
 * 关注用户
 */
export const addFollow = target =>{
    return request({
        method:'POST',
        url:"/app/v1_0/user/followings",
        data:{
            target
        }
    })
}



/**
 * 取消关注用户
 */
export const deleteFollow = userId=>{
    return request({
        method:'DELETE',
        url:`/app/v1_0/user/followings/${userId}`
    })
}


/**
 * 获取用户个人资料
 * 
 */

export const getUserprofile = target=>{
    return request({
        method:'GET',
        url:'/app/v1_0/user/profile',
        target
    })
}



/**
 * 修改用户个人资料
 * 
 */

export const updateUserprofile = target => {
    return request({
        method: 'PATCH',
        url: '/app/v1_0/user/profile',
        target
    })
}